<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('餐饮企业新增')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-redBlack-add">
			<div class="form-group">
				<label class="col-sm-3 control-label ">餐饮企业名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="name" id="name" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">招牌名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="sign" id="sign" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">餐饮企业类型：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="type" id="type" required>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">从业人数：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="workerNum" id="workerNum" onkeyup="this.value=this.value.replace(/\D/g,'')">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">地址：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="address" id="address" required>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">餐厅介绍：</label>
                <div class="col-xs-8">
                       <textarea id="remark" name="intro" maxlength="500" class="form-control" rows="2"></textarea>
                </div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">负责人姓名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="fzrName" id="fzrName" required>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">负责人电话：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="fzrTel" id="fzrTel" required>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">营业面积：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="area" id="area">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">可容乃人数：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="capacity" id="capacity" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">是否设置取水地点：</label>
				<div class="col-sm-3">
                  <label class="radio-box">
                     
                        <input type="radio"  value="1" id="status" name="isWaterPoint" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                             是</label>
                  <label class="radio-box">
                        <input type="radio" checked="" value="0" id="status" name="isWaterPoint" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                            否</label>
                 </div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">报名放心餐饮：</label>
				<div class="col-sm-3">
                  <label class="radio-box">
                     
                        <input type="radio"  value="1" id="status" name="signupSafe" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                             是</label>
                  <label class="radio-box">
                        <input type="radio" checked="" value="0" id="status" name="signupSafe" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                            否</label>
                 </div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">是否放心餐饮：</label>
				<div class="col-sm-3">
                  <label class="radio-box">
                     
                        <input type="radio"  value="1" id="status" name="isSafe" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                             是</label>
                  <label class="radio-box">
                        <input type="radio" checked="" value="0" id="status" name="isSafe" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                                            否</label>
                 </div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">放心餐饮年度：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="safeYear" id="safeYear" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">库存滴水山泉数：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="stockNum" id="stockNum" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')">
				</div>
			</div>
						
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<script type="text/javascript">
	  	
		$("#form-redBlack-add").validate();
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	add();
	        }
	    }
	
		function add() {
			var name = $("input[name='name']").val();
			var sign = $("input[name='sign']").val();
			var workerNum = $("input[name='workerNum']").val();
			var type = $("input[name='type']").val();
			var intro = $("textarea[name='intro']").val();
			var address = $("input[name='address']").val();
			var fzrName = $("input[name='fzrName']").val();
			var fzrTel = $("input[name='fzrTel']").val();
			var area = $("input[name='area']").val();
			var capacity = $("input[name='capacity']").val();
			var isWaterPoint = $("input[name='isWaterPoint']:checked").val();
			var signupSafe = $("input[name='signupSafe']:checked").val();
			var isSafe = $("input[name='isSafe']:checked").val();
			var safeYear = $("input[name='safeYear']").val();
			var stockNum = $("input[name='stockNum']").val();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "enterprise/add",
				data : {
					"name": name,
					"sign": sign,
					"workerNum": workerNum,
					"type": type,
					"intro": intro,
					"address": address,
					"fzrName": fzrName,
					"fzrTel": fzrTel,
					"area": area,
					"capacity": capacity,
					"isWaterPoint":isWaterPoint,
					"signupSafe":signupSafe,
					"isSafe":isSafe,
					"safeYear":safeYear,
					"stockNum":stockNum
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
		}
	</script>
</body>
</html>
